﻿using Newtonsoft.Json;
using ShineTech.Web.Users;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ShineTech.Web.Helpers
{
    public class SessionServer
    {
        public static ConcurrentDictionary<Guid, string> tokenDic = new ConcurrentDictionary<Guid, string>();

        public static string Get(Guid userId)
        {
            tokenDic.TryGetValue(userId, out string token);

            return token;
        }
        public static void Remove(Guid userId) 
        {
            tokenDic.TryRemove(userId, out string token);
        }
        public static void Save(Guid userId, string token) 
        {
            tokenDic.AddOrUpdate(userId,token,(k,v)=> { return v; });
        }

        
    }

   
}
